<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('product/index');?>'><em>商品列表</em></a><span>|</span>
        <a href='javascript:;' class="on" ><em>商品批量修改</em></a>
    </div>
</div>
<div>
<style>
.input-text{width:50px;}
</style>
<ul style="margin: 0pt; padding: 0pt; list-style-type: none; color: rgb(204, 0, 0);">
<li style="border: 1px solid rgb(204, 0, 0); padding: 10px; background: rgb(255, 255, 204) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-bottom: 5px;">积分为-1表示将根据销售价计算</li>
</ul>
</div>
<div class="pad_10">
<div class="common-form">
<form name="theForm" action="<?php echo U('product/beach_edit_update'); ?>" method="post" id="theForm">
<div id="price-div">
<div class="table-list">
<?php if($edit_method == 'each'):?>
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
			<th width="100">图片</th>
            <th width="100">编号</th>
            <th width="200" align='left'>产品名称</th>
            <th align='center' width="50">成本价</th>
            <th align='center' width="50">成衣价</th>
            <th align='center' width="50">定制价</th>
            <th align='center' width="50">高级定制价</th>
<!--            <th align='center' width="50">是否预售</th>-->
<!--            <th align='center' width="50">库存</th>-->
            <th align='center' width="80">赠送等级积分</th>
						<th align='center' width="80">赠送消费积分</th>
<!--						<th align='center' width="200">品牌</th>-->
            </tr>
        </thead>
        <tbody>
       <?php 
       if($productList):
       	foreach ($productList as $v):
       ?>
        <tr>
        <input type="hidden" name="product[<?php echo $v['id']?>][id]" value="<?php echo $v['id']?>">
					<td><img src="<?php echo $v['small_img']?>" width="100" height="100"></td>
					<td align='left'><?php echo $v['sn']?></td>
					<td><?php echo $v['name']?></td>
					<td align='center'><input type="text" name="product[<?php echo $v['id']?>][cost_price]" value="<?php echo $v['cost_price']?>"></td>
					<td align='center'><input type="text" name="product[<?php echo $v['id']?>][sell_price]" value="<?php echo $v['sell_price']?>"></td>
					<td align='center'><input type="text" name="product[<?php echo $v['id']?>][custom_price]" value="<?php echo $v['custom_price']?>"></td>
					<td align='center'><input type="text" name="product[<?php echo $v['id']?>][advanced_price]" value="<?php echo $v['advanced_price']?>"></td>
<!--					<td align='center'>-->
<!--					<input type="checkbox" name="product[<?php echo $v['id']?>][product_type]" value="1" <?php if($v['product_type'])echo'checked'; ?>>是-->
<!--					</td>-->
					<td align='center'><input type="text" name="product[<?php echo $v['id']?>][rank_integral]" value="<?php echo $v['rank_integral']?>"></td>
					<td align='center'><input type="text" name="product[<?php echo $v['id']?>][integral]" value="<?php echo $v['integral']?>">
					</td>
					<td align='center' style="display:none"> 
						<select name="product[<?php echo $v['id']?>][brand_id]">
			      <option value="0" selected>请选择...</option>
			      <?php if($brandList):foreach ($brandList as $brand):?>
			      <option value="<?php echo $brand['id']?>" <?php if($v['brand_id'] == $brand['id'])echo'selected';?>><?php echo $brand['name']?></option>
			      <?php endforeach;endif;?>
      </select>
					</td>
				</tr>
		<?php 
				endforeach;
			endif;
		?>
		</tbody>
		</table>
		<input type="hidden" name="edit_method" value="each" />
		<?php else:?>     
		<table width="100%" cellspacing="0" >
			<thead>
            <tr>
            <th colspan="22" align='center'>产品名称</th>
            </tr>
        </thead>
       <tbody>
       	<tr >
            <td colspan="22" align='center'>
						<?php 
			       if($productList):
			       	foreach ($productList as $k => $v):
			       	$product_ids .= (($k>0) ? ',' : '') . $v['id'];
			       		echo (($k>0) ? ' , ' : '') . $v['name'];
								endforeach;
							endif;
						?>
						</td>
            </tr>
       </tbody>
       <tfoot>
      	 <tr>
            <th align='center' width="50">市场价</th>
            <th align='center' width="50">销售价</th>
            <th align='center' width="50">成本价</th>
            <th align='center' width="50">库存</th>
            <th align='center' width="80">赠送等级积分</th>
						<th align='center' width="80">赠送消费积分</th>
						<th align='center' width="200">品牌</th>
            </tr>
       <tr>
        
					<td align='center'><input type="text" name="market_price" value=""></td>
					<td align='center'><input type="text" name="sell_price" value=""></td>
					<td align='center'><input type="text" name="cost_price" value=""></td>
					<td align='center'><input type="text" name="stock" value=""></td>
					<td align='center'><input type="text" name="rank_integral" value=""></td>
					<td align='center'><input type="text" name="integral" value="">
					</td>
					<td align='center'> 
						<select name="brand_id">
			      <option value="0" selected>请选择...</option>
			      <?php if($brandList):foreach ($brandList as $brand):?>
			      <option value="<?php echo $brand['id']?>"><?php echo $brand['name']?></option>
			      <?php endforeach;endif;?>
      </select>
					</td>
				</tr>
				</tfoot>
    </table>
    <input type="hidden" name="product_ids" value="<?php echo $product_ids?>">
    <input type="hidden" name="edit_method" value="all" />
   <?php endif;?>
</div>
    <div class="bk15"></div>
    <input name="dosubmit" type="submit" value="提交" class="button" id="dosubmit" />
    <input type="reset" value="重置" class="button" />
</form>
</div>
</div>
</body>
</html>
